<?php

namespace app\admin\model\chase;

use think\Model;

class CouponVip extends Model
{
    protected $autoWriteTimestamp = false;

    public static function add($coupon_id, $vip)
    {
        $data = [];
        foreach ($vip as $val) {
            $data[] = [
                'coupon_id' => $coupon_id,
                'user_vip_id' => $val
            ];
        }
        return self::insertAll($data);
    }

    public static function del($coupon_id)
    {
        return self::where('coupon_id', $coupon_id)->delete();
    }

    public static function getVips($coupon_id)
    {
        return self::where('coupon_id', $coupon_id)->column('user_vip_id');
    }
}
